package game.game;

import game.engine.ia.ICleverEntity;
import game.game.ia.IGameIAModel;
import game.game.network.client.IGameClientModel;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import entity.Context;
import entity.GameEntity;
import entity.map.IFieldMapEntity;

public class GameModel implements IGameIAModel, IGameClientModel
{
	private Context _context = null;

	private IFieldMapEntity _map = null;

	private Map<Integer, GameEntity> _MapGameObject = null;

	private Map<Integer, ICleverEntity> _CleverEntity = null;

	//private IdGenerator _idGenerator = null;

	public GameModel()
	{
		_MapGameObject = new HashMap<Integer, GameEntity>();
	}

	public Context getContext()
	{
		return this._context;
	}

	public void setContext( Context pContext )
	{
		this._context = pContext;
	}

	public IFieldMapEntity getMap()
	{
		return this._map;
	}

	public void setMap( IFieldMapEntity pMap )
	{
		this._map = pMap;
	}

	public void addGameObject( GameEntity pObjEntity )
	{
		_MapGameObject.put( pObjEntity.getId() , pObjEntity );
	}

	public GameEntity getGameObject( Integer pId )
	{
		return _MapGameObject.get( pId );
	}

	public List<GameEntity> getGameObjects()
	{
		return new ArrayList<GameEntity>( _MapGameObject.values() );
	}

	public GameEntity getPerso()
	{
		return _MapGameObject.get( _context.getUserId() );
	}

	@Override
	public Collection<ICleverEntity> getCleverEntities()
	{
		return _CleverEntity.values();
	}
/*
	public void setIdGenerator( IdGenerator pValue )
	{
		_idGenerator = pValue;
	}

	public IdGenerator getIdGenerator()
	{
		return _idGenerator;
	}*/

}
